
function setup()
    r = 100
    r1 = 280
    r2 = 100
    r3 = 50
    a = WIDTH/2
    b = HEIGHT/2
    k = 5/8
    
    t = 0
    t1 = 0
    t2 = 0
    t3 = 0
    i = 0
end
function draw()
    background(0, 0, 0,50)
    pushStyle()
    --background(200)
    fill(255,0,0,255)
    fontSize(15)
    --text("x="..i%WIDTH,(i+10)%WIDTH,200)
    --text("y="..i%HEIGHT,300,(i+10)%HEIGHT)
    
    i=i+1
    
    fill(0,255,0,220)
    --ellipse(500,500,i%300)
    --text("t="..math.abs(t),a+r*math.sin(t),b+r*math.cos(t))
    text("Star",35+a+r*math.sin(t),b+k*r*math.cos(t))
    
    -- star
    ellipse(a+r*math.sin(t),b+k*r*math.cos(t),30)
    text("Earth",35+a+r1*math.sin(t1),b+k*r1*math.cos(t1))
    stroke(0,240,100,255)
    strokeWidth(1)
    line(a-150,b,a+r1*math.sin(t1),b+k*r1*math.cos(t1))
        
    -- earth
    fill(0,0,255,255)
    ellipse(a+r1*math.sin(t1),b+k*r1*math.cos(t1),20)
    text("Moon",20+a+r1*math.sin(t1)+r2*math.sin(t2),b+k*r1*math.cos(t1)+k*r2*math.cos(t2))
        
    -- moon 
    fill(255,255,255,155)
    ellipse(a+r1*math.sin(t1)+r2*math.sin(t2),b+k*r1*math.cos(t1)+k*r2*math.cos(t2),15)
    --text("Sub",20+a+r1*math.sin(t1)+r2*math.sin(t2)+r3*math.sin(t3),b+k*r1*math.cos(t1)+k*r2*math.cos(t2)+k*r3*math.cos(t3))
        
    -- sub moon 
    fill(255,55,255,155)
    --ellipse(a+r1*math.sin(t1)+r2*math.sin(t2)+r3*math.sin(t3),b+k*r1*math.cos(t1)+k*r2*math.cos(t2)+k*r3*math.cos(t3),10)
    
    stroke(0,240,100,255)
    strokeWidth(1)
    fill(0,0,0,0)
    
    -- moon circle
    ellipse(a+r1*math.sin(t1),b+k*r1*math.cos(t1),r2*2,k*r2*2)
    
    -- sub moon circle
    --ellipse(a+r1*math.sin(t1)+r2*math.sin(t2),b+k*r1*math.cos(t1)+k*r2*math.cos(t2),r3*2,k*r3*2)
    
    fill(0,255,0,220)
    --text("Moon",(a+r1*math.sin(t1)+a+r*math.sin(t))/2,(b+r1*math.cos(t1)+b+r*math.cos(t))/2)
    
    stroke(100,0,100,255)
    fill(0,0,0,0)
    
    -- star circle
    ellipse(a,b,r*2,k*r*2)
    
    -- earth circle
    ellipse(a,b,r1*2,k*r1*2)
    
    pointSize(10)
    point(a,b)
    t = (t+0.0035)%6.28
    t1 = (t1+0.005)%6.28
    t2 = (t2+0.07)%6.28
    t3 = (t3+0.15)%6.28
    popStyle()
end